# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=py3-django-oauth-toolkit
pkgver=2.4.0
pkgrel=0
pkgdesc="OAuth2 Provider for Django"
url="https://django-oauth-toolkit.readthedocs.io/"
arch="noarch"
license="BSD-2-Clause-Views"
depends="
	py3-django
	py3-jwcrypto
	py3-oauthlib
	py3-requests
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-django-rest-framework
	py3-pytest-cov
	py3-pytest-django
	py3-pytest-forked
	py3-pytest-mock
	py3-pytest-xdist
	py3-tz
	"
subpackages="$pkgname-pyc"
source="https://github.com/jazzband/django-oauth-toolkit/archive/$pkgver/py3-django-oauth-toolkit-$pkgver.tar.gz
	fix-test_oauth2_validators.patch
	"
builddir="$srcdir/django-oauth-toolkit-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	DJANGO_SETTINGS_MODULE=tests.settings \
		.testenv/bin/python3 -m pytest -n auto --forked
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
ada4c7a7e5154f51f700f1b524461eb3d2899d27792b8cf72de18e5e1eb10c61e42a32596d2c18496ee641124af03e761d0f0453912e0c1d66b6c388976f10f1  py3-django-oauth-toolkit-2.4.0.tar.gz
127cdb9a19610facf7e4ccd6d8149dc978430edc61281dd75c47d0c22131d17dd57cf14998ce9d771862501ac07ac5325c3a34375aba57f46cdbff9540a027e9  fix-test_oauth2_validators.patch
"
